package com.ripple.java8.example;

import com.ripple.config.Config;
import com.ripple.core.coretypes.AccountID;
import com.ripple.crypto.ecdsa.IKeyPair;
import com.ripple.crypto.ecdsa.Seed;

import java.security.SecureRandom;

/**
 * @author xinj.x
 */
public class GenerateAddress {
    public static void main(String[] args) {
        Config.initBouncy();
        SecureRandom random = new SecureRandom();
        byte[] seedBytes = new byte[16];
        random.nextBytes(seedBytes);
        Seed seed = new Seed(seedBytes);
        IKeyPair iKeyPair = seed.keyPair();
        byte[] pub160Hash = iKeyPair.pub160Hash();
        AccountID accountID = AccountID.fromBytes(pub160Hash);
        System.out.println("secret= " + seed +  ", address=" + accountID);
    }
}
